import Home from '../views/Home.vue'
import Layout from '@/views/layout.vue'

export default [
  {
    path: '/',
    alias: '/home_page',
    name: 'Home',
    // component: Home,
    component: Layout,
    redirect: '/home',
    children: [
      {
        path: 'home',
        component: Home
      },
      {
        path: '/floder_tree',
        name: 'floder_tree',
        component: () => import('@/views/folder-tree/index.vue')
      }
    ]
    // beforeEnter: (to, from, next) => {
    //   if (from.name === "About") {
    // {    alert("这是从about页来的");
    //     next();
    //   } else {
    //     alert("这不是从about页来的");
    //     next();
    //   }}
    // }
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/login.vue')
  },
  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '@/views/About.vue'),
    meta: {
      title: '关于'
    }
  },
  {
    path: '/arg/:name',
    name: 'arg',
    component: () => import(/* webpackChunkName: "about" */ '@/views/arg.vue')
  },
  {
    path: '/parent',
    name: 'parent',
    component: () => import('@/views/parent.vue'),
    children: [
      {
        path: 'children',
        name: 'children',
        component: () => import('@/views/children.vue')
      }
    ]
  },
  {
    path: '/named_view',
    components: {
      default: () => import('@/views/children.vue'),
      email: () => import('@/views/email.vue'),
      tel: () => import('@/views/tel.vue')
    }
  },
  {
    path: '/store',
    name: 'store',
    component: () => import('@/views/store')
  },
  {
    path: '/main',
    // redirect:{
    //   // name:'Home'
    // }
    redirect: to => {
      // console.log(to)
      return {
        name: 'Home'
      }
    }
  },
  {
    path: '/testaxios',
    name: 'testaxios',
    component: () => import('@/views/axiosTest/index.vue')
  },
  {
    path: '/count-to',
    name: 'count-to',
    component: () => import('@/views/countTo/index.vue')
  },
  {
    path: '/split-pane',
    name: 'split_pane',
    component: () => import('@/views/splitPane/index.vue')
  },
  {
    path: '/render-page',
    name: 'render_page',
    component: () => import('@/views/render-page/index.vue')
  },
  {
    path: '/form',
    name: 'form',
    component: () => import('@/views/form/index.vue')
  },
  {
    path: '/',
    name: 'table',
    component: Layout,
    children: [
      {
        path: 'table',
        component: () => import('@/views/table/index.vue')
      }
    ]
  },
  {
    path: '/menu-page',
    name: 'menu_page',
    component: () => import('@/views/menu-page/index.vue')
  },
  {
    path: '*',
    component: () => import('@/views/404.vue')
  }
]
